package com.knowledge.review.jucReview;

import sun.misc.Unsafe;

import java.lang.reflect.Field;

/**
 * @author XFW
 * @date 2024/6/21 14:29
 * @Description UnsafeExample  juc底层api，慎用
 **/
public class UnsafeExample {
    private static final Unsafe UNSAFE;

    static {
        try {
            Field field = Unsafe.class.getDeclaredField("theUnsafe");
            field.setAccessible(true);
            UNSAFE = (Unsafe) field.get(null);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) {
        System.out.println(UNSAFE);
    }
}
